<?php $this->_extends('_layouts/blank_layout'); ?>

<?php $this->_block('title'); ?> - 行为日志<?php $this->_endblock(); ?>
<?php $this->_block('conpno'); ?><?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>

	<div id="getting-started">
	   <div><img src="images/chart1.png" style="border:1px solid #ccc;padding:5px;"> <img src="images/chart2.png" style="border:1px solid #ccc;padding:5px;"></div>
	   <table>
			<tr><th>主机组名</th><th>描述</th><th>创建时间</th><th>已连接主机数</th><th>总主机数</th><th>操作</th></tr>
			<?php foreach ($group as $s): ?>
			<tr><td><?php if(isset($groupc[$s->id()])){ ?><img src="images/icons/toggle-expand.png" onclick="jQuery('#hostt<?php echo $s->id;?>').toggle();"><?php }?><?php echo $s->groupname;?></td><td><?php echo $s->description;?></td><td><?php echo $s->datetime;?></td><td>0</td><td><?php if(isset($groupc[$s->id()]))echo $groupc[$s->id()]['hosts'];else echo '0';  ?></td><td>
			 <a href="<?php echo url('default::hostmanage/edit', array('group_id' => $s->id())) ?>"><img src="images/icons/edit.png"></a>
				<a href="<?php echo url('default::hostmanage/del', array('group_id' => $s->id())) ?>"><img src="images/icons/del.png"></a>
				<a href="<?php echo url('default::hostlist/state', array('groupid' => $s->id())) ?>"><img src="images/icons/hosts.png"></a></td></tr>
				<?php if(isset($groupc[$s->id()])){?>
				<tr id="hostt<?php echo $s->id;?>" ><td colspan="6">
				<ul id="hostl<?php echo $s->id;?>" class="hostlist">
					<li><span>主机名</span><span>IP</span><span>主机组</span><span>状态</span><span>主机报警数</span><span>正常记录数</span><span>总记录数</span><span>操作</span></li>
				<?php foreach (Host::nowhost($s->id()) as $ass): ?>
					<li><span><a href="<?php echo url('default::default/framework', array('mac' => $ass->macaddress,'control' => 'behaviorlog','acts' => 'index|outputs')); ?>"><?php echo $ass->macaddress;?></a></span><span><?php echo $ass->ipaddr;?></span><span><?php echo $s->groupname;?></span><span>ACTIVE</span><span><?php if(isset($groupd[$ass->macaddress]['securitys']))echo $groupd[$ass->macaddress]['securitys'];else echo '0'; ?></span><span>
					<?php 
					if(isset($groupd[$ass->macaddress]['securitys']) && isset($groupd[$ass->macaddress]['actcounts']))echo ($groupd[$ass->macaddress]['actcounts']-$groupd[$ass->macaddress]['securitys']);else echo '0'; 
					?></span><span><?php if(isset($groupd[$ass->macaddress]['actcounts']))echo $groupd[$ass->macaddress]['actcounts'];else echo '0'; ?></span><span>清空记录</span></li>
				<?php endforeach; ?>
				</ul>
				</td></tr>
				<?php } ?>
			<?php endforeach; ?>
			<tr>
				<td colspan="6"><input id="startd" type="hidden" value="<?php echo $startd;?>"><input id="endd" type="hidden" value="<?php echo $endd;?>">
					<center>共有 <font color="Red"><?php echo $pager['record_count'];?></font> 条记录,分为 <font color="Red"><?php echo $pager['page_count'];?></font> 页显示,当前第 <font color="Red"><?php echo $pager['current'];?></font>页,每页 <font color="Red"><?php echo $pager['page_size'];?></font> 条<?php echo $pagestr; ?></center>
				</td>
			</tr>
		</table>
	</div>

<?php $this->_endblock('contents'); ?>